home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / demo2.zoo / demo / ex / ex_re.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-04-24  |  2.0 KB  |  75 lines

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)ex_re.h    7.3 (Berkeley) 5/31/85
  7.  *    @(#)ex_re.h    1.1 (Bellcore)    87/04/24
  8.  */
  9.  
  10. /*
  11.  * Regular expression definitions.
  12.  * The regular expressions in ex are similar to those in ed,
  13.  * with the addition of the word boundaries from Toronto ed
  14.  * and allowing character classes to have [a-b] as in the shell.
  15.  * The numbers for the nodes below are spaced further apart then
  16.  * necessary because I at one time partially put in + and | (one or
  17.  * more and alternation.)
  18.  */
  19. struct    regexp {
  20.     char    Expbuf[ESIZE + 2];
  21.     bool    Circfl;
  22.     short    Nbra;
  23. };
  24.  
  25. /*
  26.  * There are three regular expressions here, the previous (in re),
  27.  * the previous substitute (in subre) and the previous scanning (in scanre).
  28.  * It would be possible to get rid of "re" by making it a stack parameter
  29.  * to the appropriate routines.
  30.  */
  31. var struct    regexp re;        /* Last re */
  32. var struct    regexp scanre;        /* Last scanning re */
  33. var struct    regexp subre;        /* Last substitute re */
  34.  
  35. /*
  36.  * Defining circfl and expbuf like this saves us from having to change
  37.  * old code in the ex_re.c stuff.
  38.  */
  39. #define    expbuf    re.Expbuf
  40. #define    circfl    re.Circfl
  41. #define    nbra    re.Nbra
  42.  
  43. /*
  44.  * Since the phototypesetter v7-epsilon
  45.  * C compiler doesn't have structure assignment...
  46.  */
  47. #define    savere(a)    copy(&a, &re, sizeof (struct regexp))
  48. #define    resre(a)    copy(&re, &a, sizeof (struct regexp))
  49.  
  50. /*
  51.  * Definitions for substitute
  52.  */
  53. var char    *braslist[NBRA];    /* Starts of \(\)'ed text in lhs */
  54. var char    *braelist[NBRA];    /* Ends... */
  55. var char    rhsbuf[RHSSIZE];    /* Rhs of last substitute */
  56.  
  57. /*
  58.  * Definitions of codes for the compiled re's.
  59.  * The re algorithm is described in a paper
  60.  * by K. Thompson in the CACM about 10 years ago
  61.  * and is the same as in ed.
  62.  */
  63. #define    STAR    1
  64.  
  65. #define    CBRA    1
  66. #define    CDOT    4
  67. #define    CCL    8
  68. #define    NCCL    12
  69. #define    CDOL    16
  70. #define    CEOFC    17
  71. #define    CKET    18
  72. #define    CCHR    20
  73. #define    CBRC    24
  74. #define    CLET    25
  75.